package com.nine.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.nine.dao.RolesMapper;
import com.nine.entity.Permission;
import com.nine.entity.Roles;
import com.nine.service.RolesService;

@Service
@Transactional
public class RolesServiceImpl implements RolesService {
	
	@Autowired
	private RolesMapper rolesMapper;
	
	//获取所有角色信息
	@Override
	public List<Roles> getAllRoles() {
		// TODO Auto-generated method stub
		return rolesMapper.getAllRoles();
	}
	
	//有选择性的添加用户信息
	@Override
	public int insertSelective(Roles record) {
		// TODO Auto-generated method stub
		return rolesMapper.insertSelective(record);
	}

	//根据主键有选择性的修改用户信息
	@Override
	public int updateByPrimaryKeySelective(Roles record) {
		// TODO Auto-generated method stub
		return rolesMapper.updateByPrimaryKeySelective(record);
	}

	//多项删除用户
	@Override
	public int delMoreiRoles(Integer[] ids) {
		// TODO Auto-generated method stub
		return rolesMapper.delMoreiRoles(ids);
	}
	
	//根据角色id获取该角色所拥有的权限
	@Override
	public List<Permission> getPermissionsByRoleId(Integer id) {
		// TODO Auto-generated method stub
		return rolesMapper.getPermissionsByRoleId(id);
	}
	
	//根据角色id获取该角色所未拥有的权限
	@Override
	public List<Permission> getUnpermissionsByRoleId(Integer id) {
		// TODO Auto-generated method stub
		return rolesMapper.getUnpermissionsByRoleId(id);
	}

}
